class ErrorBook extends Scene{
    private ErrorBookBack:eui.Image;
    private ShowDay:eui.Label;
    private drop_down:eui.Image;
    private day:any;//显示天数的标签
    private WrongWords:eui.Image;
    private AllWords:eui.Image;
    private TipBar:eui.Image;
    private ReviewAll:eui.Image;
    private datalist:eui.List;
    private WordsArr:any[];
    private changeday_group:eui.Group;
    private quitImg:eui.Image;
    private sureImg:eui.Image;
    private daychange_input:eui.TextInput;
    public constructor(){
        super();   
    }
    public onSkinLoaded():void{
           this.day=1111;
       if(this.day<=9&&this.day>=0){
            this.ShowDay.x=319;
            this.drop_down.x=418;        
        }
        else if(this.day>9&&this.day<=99)
        {
            this.ShowDay.x=308;
            this.drop_down.x=430;
        }
        else if(this.day>99&&this.day<=999){
             this.ShowDay.x=301;
            this.drop_down.x=441;
        }
        else if(this.day>999&&this.day<=9999){
            this.ShowDay.x=291;
            this.drop_down.x=453;
        }
        this.ShowDay.text="Day"+this.day;
        this.WordsArr=[];
        for(var i:number=0;i<20;i++){
            this.WordsArr.push({label:CET4Scene.obj[i].english,meaning:CET4Scene.obj[i].meaning});
        }
        this.datalist.dataProvider=new eui.ArrayCollection(this.WordsArr);
        this.datalist.itemRenderer=WordsLabelRenderer;
        this.ErrorBookBack.addEventListener(egret.TouchEvent.TOUCH_TAP,this.btnHandler,this);
        this.WrongWords.addEventListener(egret.TouchEvent.TOUCH_TAP,this.btnHandler,this);
        this.AllWords.addEventListener(egret.TouchEvent.TOUCH_TAP,this.btnHandler,this);
        this.drop_down.addEventListener(egret.TouchEvent.TOUCH_TAP,this.btnHandler,this);
        this.quitImg.addEventListener(egret.TouchEvent.TOUCH_TAP,this.btnHandler,this);
        this.sureImg.addEventListener(egret.TouchEvent.TOUCH_TAP,this.btnHandler,this);
    }
     private btnHandler(evt: egret.TouchEvent) {
		let btnFocused = evt.currentTarget;
		switch (btnFocused) {
            case this.ErrorBookBack:
                SceneManager.instance.removeScene(this);
                break;
            case this.WrongWords:
                this.TipBar.x=158;
                this.ReviewAll.visible=false;
                break;
            case this.AllWords:
                this.TipBar.x=510;
                this.ReviewAll.visible=true;
                break;   
            case this.drop_down:
                this.changeday_group.visible=true;
                this.daychange_input.textDisplay.text=this.ShowDay.text;
                break;
            case this.quitImg:
                this.changeday_group.visible=false;
                break;
            case this.sureImg:
                this.changeday_group.visible=false;
                this.ShowDay.text=this.daychange_input.textDisplay.text;
                break;                             
		}
	} 
}